<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="/WEB-INF/tlds/spring.tld"%>
<%@ taglib prefix="c" uri="/WEB-INF/tlds/c.tld"%>
<c:set var="BasePath" value="${pageContext.request.contextPath}"></c:set>
<c:set var="Plugins" value="${pageContext.request.contextPath}/res/plugins"></c:set>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>基础数据管理</title>
<link href="${Plugins}/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<script src="${Plugins}/jquery/jquery-1.3.2.min.js"	type="text/javascript"></script>
<link href="${Plugins}/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
<script src="${Plugins}/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script type="text/javascript" src="${BasePath}/res/js/ligerCommon.js"></script>
<style type="text/css">
#searchbar{
   margin-bottom: 10px;
   margin-left:15px;
  }
  .navbar {
		height: 20px;
		border-bottom: #E6E6E6 solid 1px;
		line-height: 20px;
	}
.l-button-search {
	width: 50px;
	margin-left: 10px;
	padding-bottom: 2px;
	display: inline;
}
</style>
</head>

<body style="padding:6px; overflow:hidden;">
<div class="navbar">
		<span>您当前的位置：</span>
		活动设置 &gt; 活动列表
</div>

<form action="../../base/activityInfo/pageActivityInfo.do" method="post" >
<div id="searchbar">
 活动名称：<input id="activityName" name="activityName" type="text" value="${activityInfo.activityName}" />&nbsp;&nbsp;
 活动编码：<input id="activityCode" name="activityCode" type="text" value="${activityInfo.activityCode}" />
           <input id="btnOK" type="submit" value="查询" class="l-button-search" />
           <input type="button" id="resetBtn" value="重置" class="l-button-search" />
        
</div>
</form>

<div id="maingrid4" style="margin:0; padding:0"></div>
  <div style="display:none;">
  <!-- g data total ttt -->
</div>

<script>
    var basePath='${BasePath}';
    var grid = null;
    var activityData = {"Rows": ${activityList}, "Total": ${activityNum}};
    console.log('cc',WIN_TAB);
    $(function () {
    	 // 重置
        $("#resetBtn").click(function(){
    		$('#searchbar :input').not(':submit, :button, :reset').val('').removeAttr('checked').removeAttr('selected');
    	});
    	
        grid = $("#maingrid4").ligerGrid({
            columns: [
            { display: '活动名称', name: 'activityName',width:"12%",align:"left"},
            { display: '活动编码', name: 'activityCode',width:"8%"},
            { display: '活动起始时间', name: 'beginTime',width:"8%"},
            { display: '活动结束时间', name: 'endTime',width:"8%"},
            { display: '操作', isSort: false,width:"23%", render: function (rowdata, rowindex, value){
                var h = "";
                h += "<a href='javascript:setProfits(" + rowindex + ")'>让利比例设置</a> &nbsp;";
                h += "<a href='javascript:updateLogisticCheck(" + rowindex + ")'>修改</a> &nbsp;";
                h += "<a href='javascript:detailLogisticInfoCheck(" + rowindex + ")'>详情</a> &nbsp;";
           
                return h;
            }
        }
            ], 
            pageSize:30,
            width: '100%',height:'100%',
            data: $.extend(true,{},activityData),
        });
    });

    function updateLogisticCheck(rowindex){
  	    var codeValue=grid.getData()[rowindex].activityCode;
        var url=basePath+'/base/logisticsManageController/toUpdateLogisticInfo.do?activityCode='+codeValue;
        url+="&pTabid="+WIN_TAB.getSelectedTabItemID();
  	  window.parent.f_addTab('修改','修改',url);
    }
    
    function detailLogisticInfoCheck(rowindex){
  	    var codeValue=grid.getData()[rowindex].activityCode;
        var url=basePath+'/base/logisticsManageController/detailLogisticInfo.do?activityCode='+codeValue;
        url+="&pTabid="+WIN_TAB.getSelectedTabItemID();
  	  window.parent.f_addTab('明细','明细',url);
    }
    
    function setProfits(rowindex){
       var codeValue=grid.getData()[rowindex].activityCode;
       var url=basePath+'/base/activityInfoController/toSetProfits.do?activityCode='+codeValue;
       url+="&pTabid="+WIN_TAB.getSelectedTabItemID();
  	  window.parent.f_addTab('让利比例设置','让利比例设置',url);
    }
    
 </script>
</body>
</html>